package com.fjnu.dao;

import com.fjnu.entity.Article;
import com.fjnu.dto.ArticleConditionDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;

@Mapper
public interface ArticleDao {
    int insert(Article article);
    int updateContent(@Param("id") Integer id, @Param("newContent") String newContent);
    int updateTitle(@Param("id") Integer id, @Param("newTitle") String newTitle);
    int updateStatus(@Param("id") Integer id, @Param("newStatus") Integer newStatus);
    int batchUpdateStatus(@Param("ids") List<Integer> ids, @Param("newStatus") Integer newStatus);
    int deleteById(Integer id);
    List<Article> selectByUserId(Integer userId);
    List<Article> selectByKeyWord(String keyword);
    List<Article> selectByTimePeriod(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
    List<Article> selectByTag(Integer tagId);
    List<Article> selectByCategory(Integer categoryId);
    Article selectById(Integer id);
    List<Article> selectByCondition(ArticleConditionDto condition);
    int countByCondition(ArticleConditionDto condition);
    List<Article> selectByConditionWithLimit(@Param("condition") ArticleConditionDto condition,
                                             @Param("startIndex") Integer startIndex,
                                             @Param("endIndex") Integer endIndex);
}